<?php
/* 	These code was generated using phpCIGen v 2.a (21/05/2012)
	#zaqi 		zaqi.smart@gmail.com,http://zenzaqi.blogspot.com,
	#CV. Trust Solution, jl. Saronojiwo 2/19 Surabaya, http://www.ts.co.id

	+ Module  		: m_pasal View
	+ Description	: For record view
	+ Filename 		: v_m_pasal.php
 	+ creator  		: 
 	+ Created on 24/Jul/2012 11:40:14

*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<style type="text/css">
        p { width:650px; }
		.search-item {
			font:normal 11px tahoma, arial, helvetica, sans-serif;
			padding:3px 10px 3px 10px;
			border:1px solid #fff;
			border-bottom:1px solid #eeeeee;
			white-space:normal;
			color:#555;
		}
		.search-item h3 {
			display:block;
			font:inherit;
			font-weight:bold;
			color:#222;
		}

		.search-item h3 span {
			float: right;
			font-weight:normal;
			margin:0 0 5px 5px;
			width:100px;
			display:block;
			clear:none;
		}
    </style>
<script>
/* declare function */
var m_pasal_DataStore;
var m_pasal_ColumnModel;
var m_pasal_ListEditorGrid;
var m_pasal_saveForm;
var m_pasal_searchForm;
var m_pasal_searchWindow;
var m_pasal_SelectedRow;
var m_pasal_ContextMenu;
/* decalare KONSTANSTA */
var FAILED_SAVE="Data gagal disimpan";
var FAILED_CONNECTION="Koneksi database server gagal, hubungi Administrator";
var FAILED_VALID_FORM="Data input belum sempurna";
var FAILED_DELETE_SELECTED="Tidak ada data yang terpilih untuk dihapus";
var FAILED_UPDATE_SELECTED="Tidak ada data yang terpilih untuk diupdate";
var FAILED_DELETE="Data gagal dihapus";
var FAILED_EXCEL="Data gagal diexport ke Excel";
var FAILED_PRINT="Data gagal dicetak";
var FAILED_PERMISSION="Anda tidak mempunyai akses untuk aksi ini";
var CONFIRM_DELETE="Apakah Anda yakin menghapus rekod ini?";
var CONFIRM_MULTI_DELETE="Apakah Anda yakin menghapus rekod-rekod ini?";
var SUCCESS_SAVE="Data sukses disimpan";
var TITLE_LIST="Daftar Data";
var TITLE_FORM="Form Input/Update";
var TITLE_FORM_SEARCH="Pencarian Lanjut";
var BTN_SAVE="Simpan";
var BTN_SEARCH="Cari";
var BTN_CANCEL="Batal";
var BTN_ADD_TITLE="Tambah";
var BTN_EDIT_TITLE="Ubah";
var BTN_DELETE_TITLE="Hapus";
var BTN_SEARCH_TITLE="Pencarian";
var BTN_PRINT_TITLE="Cetak";
var BTN_EXCEL_TITLE="Export Excel";
var BTN_REFRESH_TITLE="Refresh";
var BTN_ADD_TOOLTIP="Tambah Data Baru";
var BTN_EDIT_TOOLTIP="Ubah Data";
var BTN_DELETE_TOOLTIP="Hapus Data";
var BTN_SEARCH_TOOLTIP="Pencarian Data Lanjut";
var BTN_SIMPLE_SEARCH_TOOLTIP="Pencarian Sederhana";
var BTN_PRINT_TOOLTIP="Cetak Data (html)";
var BTN_EXCEL_TOOLTIP="Export ke bentuk Excel";
var BTN_REFERSH_TOOLTIP="Refresh Data";
var INFO_REQUIRED="Wajib diisi";
var PERMISSION="RCUD";
//declare konstant
var post2db = 'CREATE';
var msg = 'created';
var pageS=15;

/* declare variable here for Field*/
var pasal_idField;
var pasal_seqField;
var pasal_noField;
var pasal_titleField;
var pasal_contentField;
var pasal_activeField;
var pasal_typeField;
var pasal_created_dateField;
var pasal_created_byField;
var pasal_updated_dateField;
var pasal_updated_byField;
var pasal_updated_countField;
/* For search form */
var pasal_idSearchField;
var pasal_seqSearchField;
var pasal_noSearchField;
var pasal_titleSearchField;
var pasal_contentSearchField;
var pasal_activeSearchField;
var pasal_created_dateSearchField;
var pasal_created_bySearchField;
var pasal_updated_dateSearchField;
var pasal_updated_bySearchField;
var pasal_updated_countSearchField;

/* on ready fuction */
Ext.onReady(function(){
  	Ext.QuickTips.init();	/* Initiate quick tips icon */

  	/* Function for Saving inLine Editing */
	function m_pasal_inline_update(oGrid_event){

	var patt=new RegExp("U");
	if(patt.test(PERMISSION)==false){

		Ext.MessageBox.show({
		   title: 'Warning',
		   msg: FAILED_PERMISSION,
		   buttons: Ext.MessageBox.OK,
		   animEl: 'security',
		   icon: Ext.MessageBox.WARNING
		});

	}else{

		var pasal_id_update_pk="";
		var pasal_seq_update=null;
		var pasal_no_update=null;
		var pasal_title_update=null;
		var pasal_content_update=null;
		var pasal_active_update=null;
		var pasal_created_date_update_date="";
		var pasal_created_by_update=null;
		var pasal_updated_date_update_date="";
		var pasal_updated_by_update=null;
		var pasal_updated_count_update=null;

		pasal_id_update_pk = oGrid_event.record.data.pasal_id;
		if(oGrid_event.record.data.pasal_seq!== null){pasal_seq_update = oGrid_event.record.data.pasal_seq;}
		if(oGrid_event.record.data.pasal_no!== null){pasal_no_update = oGrid_event.record.data.pasal_no;}
		if(oGrid_event.record.data.pasal_title!== null){pasal_title_update = oGrid_event.record.data.pasal_title;}
		if(oGrid_event.record.data.pasal_content!== null){pasal_content_update = oGrid_event.record.data.pasal_content;}    
		if(oGrid_event.record.data.pasal_active!== null){pasal_active_update = oGrid_event.record.data.pasal_active;}
	 	/* if(oGrid_event.record.data.pasal_created_date!== ""){pasal_created_date_update_date =oGrid_event.record.data.pasal_created_date.format('Y-m-d');}
		if(oGrid_event.record.data.pasal_created_by!== null){pasal_created_by_update = oGrid_event.record.data.pasal_created_by;}
	 	if(oGrid_event.record.data.pasal_updated_date!== ""){pasal_updated_date_update_date =oGrid_event.record.data.pasal_updated_date.format('Y-m-d');}
		if(oGrid_event.record.data.pasal_updated_by!== null){pasal_updated_by_update = oGrid_event.record.data.pasal_updated_by;}
		if(oGrid_event.record.data.pasal_updated_count!== null){pasal_updated_count_update = oGrid_event.record.data.pasal_updated_count;} */

		Ext.Ajax.request({
			waitMsg: 'Please wait...',
			url: 'index.php?c=c_m_pasal&m=get_action',
			params: {
				pasal_id	: pasal_id_update_pk,
				pasal_seq	:pasal_seq_update,
				pasal_no	:pasal_no_update,
				pasal_title	:pasal_title_update,
				pasal_content	:pasal_content_update,
				pasal_active	:pasal_active_update,
				pasal_created_date	: pasal_created_date_update_date,
				pasal_created_by	:pasal_created_by_update,
				pasal_updated_date	: pasal_updated_date_update_date,
				pasal_updated_by	:pasal_updated_by_update,
				pasal_updated_count	:pasal_updated_count_update,
				task: "UPDATE"
			},
			success: function(response){
				var result=eval(response.responseText);
				switch(result){
					case 1:
						m_pasal_DataStore.commitChanges();
						m_pasal_DataStore.reload();
						break;
					default:
						Ext.MessageBox.show({
						   title: 'Warning',
						   msg: FAILED_SAVE,
						   buttons: Ext.MessageBox.OK,
						   animEl: 'save',
						   icon: Ext.MessageBox.WARNING
						});
						break;
				}
			},
			failure: function(response){
				var result=response.responseText;
				Ext.MessageBox.show({
				   title: 'Error',
				   msg: FAILED_CONNECTION,
				   buttons: Ext.MessageBox.OK,
				   animEl: 'database',
				   icon: Ext.MessageBox.ERROR
				});
			}
		});

		}
	}
  	/* End of Function */

  	/* Function for add and edit data form, open window form */
	function m_pasal_save(){

		var patt=new RegExp("U");
		var patt2=new RegExp("C");
		if(patt.test(PERMISSION)==false && patt2.test(PERMISSION)==false){

			Ext.MessageBox.show({
			   title: 'Warning',
			   msg: FAILED_PERMISSION,
			   buttons: Ext.MessageBox.OK,
			   animEl: 'security',
			   icon: Ext.MessageBox.WARNING
			});

		}else{

		if(is_m_pasal_form_valid()){
			var pasal_id_field_pk=null;
			var pasal_seq_field=null;
			var pasal_no_field=null;
			var pasal_title_field=null;
			var pasal_content_field=null;
			var pasal_active_field=null;
			var pasal_type_field=null;
			var pasal_created_date_field_date="";
			var pasal_created_by_field=null;
			var pasal_updated_date_field_date="";
			var pasal_updated_by_field=null;
			var pasal_updated_count_field=null;

			pasal_id_field_pk=get_pk_id();
			if(pasal_seqField.getValue()!== null){pasal_seq_field = pasal_seqField.getValue();}
			if(pasal_noField.getValue()!== null){pasal_no_field = pasal_noField.getValue();}
			if(pasal_titleField.getValue()!== null){pasal_title_field = pasal_titleField.getValue();}
			if(pasal_contentField.getValue()!== null){pasal_content_field = pasal_contentField.getValue();}
			if(pasal_activeField.getValue()!== null){pasal_active_field = pasal_activeField.getValue();}
			if(pasal_typeField.getValue()!== null){pasal_type_field = pasal_typeField.getValue();}
			/* if(pasal_created_dateField.getValue()!== ""){pasal_created_date_field_date = pasal_created_dateField.getValue().format('Y-m-d');}
			if(pasal_created_byField.getValue()!== null){pasal_created_by_field = pasal_created_byField.getValue();}
			if(pasal_updated_dateField.getValue()!== ""){pasal_updated_date_field_date = pasal_updated_dateField.getValue().format('Y-m-d');}
			if(pasal_updated_byField.getValue()!== null){pasal_updated_by_field = pasal_updated_byField.getValue();}
			if(pasal_updated_countField.getValue()!== null){pasal_updated_count_field = pasal_updated_countField.getValue();} */
			
			if(pasal_activeField.getValue()!== null){pasal_active_field = pasal_activeField.items.get(0).getGroupValue();}
			
			Ext.Ajax.request({
				waitMsg: 'Please wait...',
				url: 'index.php?c=c_m_pasal&m=get_action',
				params: {
					pasal_id	: pasal_id_field_pk,
					pasal_seq	: pasal_seq_field,
					pasal_no	: pasal_no_field,
					pasal_title	: pasal_title_field,
					pasal_content	: pasal_content_field,
					pasal_active	: pasal_active_field,
					pasal_type	: pasal_type_field,
					pasal_created_date	: pasal_created_date_field_date,
					pasal_created_by	: pasal_created_by_field,
					pasal_updated_date	: pasal_updated_date_field_date,
					pasal_updated_by	: pasal_updated_by_field,
					pasal_updated_count	: pasal_updated_count_field,
					task: post2db
				},
				success: function(response){
					var result=eval(response.responseText);
					switch(result){
						case 1:
							Ext.MessageBox.alert(post2db+' OK',SUCCESS_SAVE);
							post2db = "CREATE";
							m_pasal_DataStore.reload();
							m_pasal_reset_form();
							break;
						case 3:
							Ext.MessageBox.show({
							   title: 'Warning',
							   msg: "Nomor pasal sudah dipakai",
							   buttons: Ext.MessageBox.OK,
							   animEl: 'save',
							   icon: Ext.MessageBox.WARNING
							});
							break;
						case 4:
							Ext.MessageBox.show({
							   title: 'Warning',
							   msg: "Seq pasal sudah dipakai",
							   buttons: Ext.MessageBox.OK,
							   animEl: 'save',
							   icon: Ext.MessageBox.WARNING
							});
							break;
						default:
							Ext.MessageBox.show({
							   title: 'Warning',
							   msg: FAILED_SAVE,
							   buttons: Ext.MessageBox.OK,
							   animEl: 'save',
							   icon: Ext.MessageBox.WARNING
							});
							break;
					}
				},
				failure: function(response){
					var result=response.responseText;
					Ext.MessageBox.show({
						   title: 'Error',
						   msg: FAILED_CONNECTION,
						   buttons: Ext.MessageBox.OK,
						   animEl: 'database',
						   icon: Ext.MessageBox.ERROR
					});
				}
			});
		} else {
			Ext.MessageBox.show({
				title: 'Warning',
				msg: FAILED_VALID_FORM,
				buttons: Ext.MessageBox.OK,
				animEl: 'save',
				icon: Ext.MessageBox.WARNING
			});
		}

		}
	}
 	/* End of Function */

  	/* Function for get PK field */
	function get_pk_id(){
		if(post2db=='UPDATE')
			return m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_id');
		else
			return 0;
	}
	/* End of Function  */

	/* Reset form before loading */
	function m_pasal_reset_form(){
		/* pasal_idField.reset();
		pasal_idField.setValue(null); */
		pasal_typeField.reset();
		pasal_typeField.setValue(null);
		pasal_seqField.reset();
		pasal_seqField.setValue(null);
		pasal_noField.reset();
		pasal_noField.setValue(null);
		pasal_titleField.reset();
		pasal_titleField.setValue(null);
		pasal_contentField.reset();
		pasal_contentField.setValue(null);
		pasal_activeField.reset();
		pasal_activeField.setValue('Ya', true);
		/* pasal_created_dateField.reset();
		pasal_created_dateField.setValue(null);
		pasal_created_byField.reset();
		pasal_created_byField.setValue(null);
		pasal_updated_dateField.reset();
		pasal_updated_dateField.setValue(null);
		pasal_updated_byField.reset();
		pasal_updated_byField.setValue(null);
		pasal_updated_countField.reset();
		pasal_updated_countField.setValue(null); */
	}
 	/* End of Function */

	/* setValue to EDIT */
	function m_pasal_set_form(){
		/* pasal_idField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_id')); */
		pasal_typeField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_type'));
		pasal_seqField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_seq'));
		pasal_noField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_no'));
		pasal_titleField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_title'));
		pasal_contentField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_content'));
		pasal_activeField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_active'));
		/* pasal_created_dateField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_created_date'));
		pasal_created_byField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_created_by'));
		pasal_updated_dateField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_updated_date'));
		pasal_updated_byField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_updated_by'));
		pasal_updated_countField.setValue(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_updated_count')); */
		if(m_pasal_ListEditorGrid.getSelectionModel().getSelected().get('pasal_active') == 'Y'){
			pasal_activeField.setValue('pasal_aktif', true);
		}else{
			pasal_activeField.setValue('pasal_unaktif', true);
		}
	}
	/* End setValue to EDIT*/

	/* Function for Check if the form is valid */
	function is_m_pasal_form_valid(){
		return (pasal_seqField.isValid() && pasal_noField.isValid() );
	}
  	/* End of Function */

  	/* Function for Displaying  create Window Form */
	function display_form_window(){
			post2db='CREATE';
			msg='created';
			m_pasal_reset_form();
	}
  	/* End of Function */

  	/* Function for Delete Confirm */
	function m_pasal_confirm_delete(){
		// only one m_pasal is selected here
		if(m_pasal_ListEditorGrid.selModel.getCount() == 1){
			Ext.MessageBox.confirm('Confirmation',CONFIRM_DELETE, m_pasal_delete);
		} else if(m_pasal_ListEditorGrid.selModel.getCount() > 1){
			Ext.MessageBox.confirm('Confirmation',CONFIRM_MULTI_DELETE, m_pasal_delete);
		} else {
			Ext.MessageBox.show({
				title: 'Warning',
				msg: FAILED_DELETE_SELECTED,
				buttons: Ext.MessageBox.OK,
				animEl: 'save',
				icon: Ext.MessageBox.WARNING
			});
		}
	}
  	/* End of Function */

	/* Function for Update Confirm */
	function m_pasal_confirm_update(){
		/* only one record is selected here */
		if(m_pasal_ListEditorGrid.selModel.getCount() == 1) {
			post2db='UPDATE';
			msg='updated';
			m_pasal_set_form();
		} else {
			Ext.MessageBox.show({
				title: 'Warning',
				msg: FAILED_UPDATE_SELECTED,
				buttons: Ext.MessageBox.OK,
				animEl: 'save',
				icon: Ext.MessageBox.WARNING
			});
		}
	}
  	/* End of Function */

  	/* Function for Delete Record */
	function m_pasal_delete(btn){
		if(btn=='yes'){

		var patt=new RegExp("D");
		if(patt.test(PERMISSION)==false){

			Ext.MessageBox.show({
			   title: 'Warning',
			   msg: FAILED_PERMISSION,
			   buttons: Ext.MessageBox.OK,
			   animEl: 'security',
			   icon: Ext.MessageBox.WARNING
			});

		}else{

			var selections = m_pasal_ListEditorGrid.selModel.getSelections();
			var prez = [];
			for(i = 0; i< m_pasal_ListEditorGrid.selModel.getCount(); i++){
				prez.push(selections[i].json.pasal_id);
			}
			var encoded_array = Ext.encode(prez);
			Ext.Ajax.request({
				waitMsg: 'Please Wait',
				url: 'index.php?c=c_m_pasal&m=get_action',
				params: { task: "DELETE", ids:  encoded_array },
				success: function(response){
					var result=eval(response.responseText);
					switch(result){
						case 1:
							m_pasal_DataStore.reload();
							break;
						default:
							Ext.MessageBox.show({
								title: 'Warning',
								msg: FAILED_DELETE,
								buttons: Ext.MessageBox.OK,
								animEl: 'save',
								icon: Ext.MessageBox.WARNING
							});
							break;
					}
				},
				failure: function(response){
					var result=response.responseText;
					Ext.MessageBox.show({
					   title: 'Error',
					   msg: FAILED_CONNECTION,
					   buttons: Ext.MessageBox.OK,
					   animEl: 'database',
					   icon: Ext.MessageBox.ERROR
					});
				}
			});

			}

		}
	}
  	/* End of Function */

	/* Function for Retrieve DataStore */
	m_pasal_DataStore = new Ext.data.Store({
		id: 'm_pasal_DataStore',
		proxy: new Ext.data.HttpProxy({
			url: 'index.php?c=c_m_pasal&m=get_action',
			method: 'POST'
		}),
		baseParams:{task: "LIST", start:0, limit: pageS},
		reader: new Ext.data.JsonReader({
			root: 'results',
			totalProperty: 'total',
			id: 'pasal_id'
		},[
			{name: 'pasal_id', type: 'int', mapping: 'pasal_id'},
			{name: 'pasal_seq', type: 'int', mapping: 'pasal_seq'},
			{name: 'pasal_no', type: 'string', mapping: 'pasal_no'},
			{name: 'pasal_title', type: 'string', mapping: 'pasal_title'},
			{name: 'pasal_type', type: 'string', mapping: 'pasal_type'},
			{name: 'pasal_content', type: 'string', mapping: 'pasal_content'},
			{name: 'pasal_active', type: 'string', mapping: 'pasal_active'},
			{name: 'pasal_created_date', type: 'date', dateFormat: 'Y-m-d H:i:s', mapping: 'pasal_created_date'},
			{name: 'pasal_created_by', type: 'string', mapping: 'pasal_created_by'},
			{name: 'pasal_updated_date', type: 'date', dateFormat: 'Y-m-d H:i:s', mapping: 'pasal_updated_date'},
			{name: 'pasal_updated_by', type: 'string', mapping: 'pasal_updated_by'},
			{name: 'pasal_updated_count', type: 'int', mapping: 'pasal_updated_count'}
		])//,
//		sortInfo:{field: 'pasal_type', direction: "ASC"}
	});
	/* End of Function */

  	/* Function for Identify of Window Column Model */
	m_pasal_ColumnModel = new Ext.grid.ColumnModel(
		[
		{
			header: 'Id',
			dataIndex: 'pasal_id',
			width: 150,
			sortable: true,
			hidden : true
		},
		{
			header: 'Jenis',
			dataIndex: 'pasal_type',
			width: 150,
			sortable: true
		},
		{
			header: 'Pasal Seq',
			dataIndex: 'pasal_seq',
			width: 150,
			sortable: true
		},
		{
			header: 'No Pasal',
			dataIndex: 'pasal_no',
			width: 150,
			sortable: true
		},
		{
			header: 'Judul',
			dataIndex: 'pasal_title',
			width: 150,
			sortable: true
		},
		{
			header: 'Isi',
			dataIndex: 'pasal_content',
			width: 150,
			sortable: true,
			hidden : true
		},
		{
			header: 'Aktif',
			dataIndex: 'pasal_active',
			width: 150,
			sortable: true
		},
		{
			header: 'Created Date',
			dataIndex: 'pasal_created_date',
			width: 150,
			sortable: true,
			renderer: Ext.util.Format.dateRenderer('Y-m-d'),
			hidden : true
		},
		{
			header: 'Created By',
			dataIndex: 'pasal_created_by',
			width: 150,
			sortable: true,
			hidden : true
		},
		{
			header: 'Updated Date',
			dataIndex: 'pasal_updated_date',
			width: 150,
			sortable: true,
			renderer: Ext.util.Format.dateRenderer('Y-m-d'),
			hidden  : true
		},
		{
			header: 'Updated By',
			dataIndex: 'pasal_updated_by',
			width: 150,
			sortable: true,
			hidden : true
		},
		{
			header: 'Updated Count',
			dataIndex: 'pasal_updated_count',
			width: 150,
			sortable: true,
			hidden : true
		}	]);

	m_pasal_ColumnModel.defaultSortable= true;
	/* End of Function */

    /* Button Control */
    m_pasal_gbtn_add=new Ext.Button({
	    text: BTN_ADD_TITLE,
		tooltip: BTN_ADD_TOOLTIP,
		iconCls:'icon-adds',
		handler: display_form_window
    });

    m_pasal_gbtn_update=new Ext.Button({
	    text: BTN_EDIT_TITLE,
		tooltip: BTN_EDIT_TOOLTIP,
		iconCls:'icon-update',
		handler: m_pasal_confirm_update
	});

    m_pasal_gbtn_delete=new Ext.Button({
	    text: BTN_DELETE_TITLE,
		tooltip: BTN_DELETE_TOOLTIP,
		iconCls:'icon-delete',
		handler: m_pasal_confirm_delete
	});

    /*Context Menu Button */

	m_pasal_cbtn_update=new Ext.menu.Item({
		text: BTN_EDIT_TITLE,
		tooltip: BTN_EDIT_TOOLTIP,
		iconCls:'icon-update',
		handler: m_pasal_editContextMenu
	});

	m_pasal_cbtn_delete=new Ext.menu.Item({
		text: BTN_DELETE_TITLE,
		tooltip: BTN_DELETE_TOOLTIP,
		iconCls:'icon-delete',
		handler: m_pasal_confirm_delete
	});

	/* Declare DataStore and  show datagrid list */
	m_pasal_ListEditorGrid =  new Ext.grid.EditorGridPanel({
		id: 'm_pasal_ListEditorGrid',
		el: 'fp_m_pasal',
		title: TITLE_LIST,
		autoHeight: true,
		collapsible: true,
		store: m_pasal_DataStore, // DataStore
		cm: m_pasal_ColumnModel, // Nama-nama Columns
		enableColLock:false,
		frame: true,
		clicksToEdit:2, // 2xClick untuk bisa meng-Edit inLine Data
		selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
		viewConfig: { forceFit:true },
	  	width: 800,
		bbar: new Ext.PagingToolbar({
			pageSize: pageS,
			store: m_pasal_DataStore,
			displayInfo: true
		}),
		/* Add Control on ToolBar */
		tbar: [
		m_pasal_gbtn_add, '-',
		m_pasal_gbtn_update, '-',
		m_pasal_gbtn_delete, /* '-',
		{
			text: BTN_SEARCH_TITLE,
			tooltip: BTN_SEARCH_TOOLTIP,
			iconCls:'icon-search',
			handler: display_form_search_window
		}, '-', */
		new Ext.app.SearchField({
			store: m_pasal_DataStore,
			listeners:{
				specialkey: function(f,e){
					if(e.getKey() == e.ENTER){
						m_pasal_DataStore.baseParams={task:'LIST', start:0, limit:pageS};
		            }
				},
				render: function(c){
				Ext.get(this.id).set({qtitle: BTN_SIMPLE_SEARCH_TOOLTIP});
				}
			},
			width: 120
		}),'-',{
			text: BTN_REFRESH_TITLE,
			tooltip: BTN_REFERSH_TOOLTIP,
			handler: m_pasal_reset_search,
			iconCls:'icon-refresh'
		}/* ,'-',{
			text: BTN_EXCEL_TITLE,
			tooltip: BTN_EXCEL_TOOLTIP,
			iconCls:'icon-xls',
			handler: m_pasal_export_excel
		}, '-',{
			text: BTN_PRINT_TITLE,
			tooltip: BTN_PRINT_TOOLTIP,
			iconCls:'icon-print',
			handler: m_pasal_print
		} */
		]
	});
	m_pasal_ListEditorGrid.render();
	/* End of DataStore */

	/* Create Context Menu */
	m_pasal_ContextMenu = new Ext.menu.Menu({
		id: 'm_pasal_ContextMenu',
		items: [
		m_pasal_cbtn_update,
		m_pasal_cbtn_delete,
		'-',
		{
			text: BTN_PRINT_TITLE,
			tooltip: BTN_PRINT_TOOLTIP,
			iconCls:'icon-print',
			handler: m_pasal_print
		},
		{
			text: BTN_EXCEL_TITLE,
			tooltip: BTN_EXCEL_TOOLTIP,
			iconCls:'icon-xls',
			handler: m_pasal_export_excel
		}
		]
	});
	/* End of Declaration */

	/* Event while selected row via context menu */
	function onm_pasal_ContextMenu(grid, rowIndex, e) {
		e.stopEvent();
		var coords = e.getXY();
		m_pasal_ContextMenu.rowRecord = grid.store.getAt(rowIndex);
		grid.selModel.selectRow(rowIndex);
		m_pasal_SelectedRow=rowIndex;
		m_pasal_ContextMenu.showAt([coords[0], coords[1]]);
  	}
  	/* End of Function */

	/* function for editing row via context menu */
	function m_pasal_editContextMenu(){
		//m_pasal_ListEditorGrid.startEditing(m_pasal_SelectedRow,1);
		m_pasal_confirm_update();
  	}
	/* End of Function */

	m_pasal_ListEditorGrid.addListener('rowcontextmenu', onm_pasal_ContextMenu);
	m_pasal_DataStore.load({params: {start: 0, limit: pageS}});	// load DataStore
	m_pasal_ListEditorGrid.on('afteredit', m_pasal_inline_update); // inLine Editing Record

	pasal_idField= new Ext.form.NumberField({
		id: 'pasal_idField',
		fieldLabel: 'Id ',
		allowNegatife : false,
		blankText: '0',
		allowDecimals: false,
		anchor: '95%',
		maskRe: /([0-9]+)$/
	});
	pasal_seqField= new Ext.form.NumberField({
		id: 'pasal_seqField',
		fieldLabel: 'Pasal Seq ',
		allowNegatife : false,
		blankText: '0',
		allowDecimals: false,
		anchor: '95%',
		maskRe: /([0-9]+)$/
	});
	pasal_typeField =  new Ext.form.ComboBox({
		id : 'pasal_typeField',
		fieldLabel : 'Jenis Pasal',
		store : ['SPJB','SPB','IPB'],
		allowBlank : false,
		triggerAction: 'all'
	});
	pasal_noField= new Ext.form.TextField({
		id: 'pasal_noField',
		fieldLabel: 'No Pasal ',
		maxLength: 45,
		anchor: '95%'
	});
	pasal_titleField= new Ext.form.TextField({
		id: 'pasal_titleField',
		fieldLabel: 'Judul ',
		maxLength: 200,
		anchor: '95%'
	});
	var valueee = "<ol><li>adasdasd</li><ul style='list-style-type:lower-alpha;'><li>ngetesssss<br></li></ul><li>sdfdsfsdfdsf<br></li></ol><br>";
	/*pasal_contentField= new Ext.form.HtmlEditor({
		id: 'pasal_contentField',
		fieldLabel: 'Isi ',
		hideLabel       : false,
		labelSeparator  : '',
		name            : 'description',
		value           : valueee,
		anchor          : '100% 100%',
		html : '<style>ul{list-style-type: lower-alpha;}</style>',
		plugins         : Ext.ux.form.HtmlEditor.plugins()*/
		/*maxLength: 2000,
		width : '100%',
		enableLinks : false,
		enableSourceEdit: true,
		html : '<style>ul{list-style-type: lower-alpha;}</style>',
		setValue : function(v){
			  Ext.form.HtmlEditor.superclass.setValue.call(this, Ext.util.Format.htmlDecode(v));
			  this.pushValue();
	    },
		plugins :  Ext.ux.form.HtmlEditor.plugins()*/
		
	//});
	/* pasal_activeField= new Ext.form.TextField({
		id: 'pasal_activeField',
		fieldLabel: 'Aktif ',
		maxLength: 1,
		anchor: '95%'
	}); */
	pasal_contentField = new Ext.ux.TinyMCE({
		fieldLabel: 'Isi',
		hideLabel: false,
		tinymceSettings: {
			mode : "textareas",
			theme : "advanced",
			plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
			theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,code,|,insertdate,preview,|,forecolor,backcolor",
			theme_advanced_buttons3 : "tablecontrols,|",
			theme_advanced_buttons4 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "none",
			theme_advanced_resizing : false,
			theme_advanced_source_editor_height : 500
			//theme_advanced_path : false//,
			//extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
		},
		width: "98%",
		height: "500",
		value: ""
	});
	pasal_activeField = new Ext.form.RadioGroup({
		fieldLabel : 'Aktif',
		id : 'pasal_activeField',
		width : 150,
		defaults : {xtype : 'radio', name : 'pasal_activeField'},
		items : [
			{
				id : 'pasal_aktif',
				boxLabel : 'Ya',
				inputValue : 'Y',
				checked : true
			},{
				id : 'pasal_unaktif',
				boxLabel : 'Tidak',
				inputValue : 'T'
			}
		]
	});
	pasal_created_dateField= new Ext.form.DateField({
		id: 'pasal_created_dateField',
		fieldLabel: 'Created Date ',
		format : 'Y-m-d',
		anchor: '95%'
	});
	pasal_created_byField= new Ext.form.TextField({
		id: 'pasal_created_byField',
		fieldLabel: 'Created By ',
		maxLength: 45,
		anchor: '95%'
	});
	pasal_updated_dateField= new Ext.form.DateField({
		id: 'pasal_updated_dateField',
		fieldLabel: 'Updated Date ',
		format : 'Y-m-d',
		anchor: '95%'
	});
	pasal_updated_byField= new Ext.form.TextField({
		id: 'pasal_updated_byField',
		fieldLabel: 'Updated By ',
		maxLength: 45,
		anchor: '95%'
	});
	pasal_updated_countField= new Ext.form.NumberField({
		id: 'pasal_updated_countField',
		fieldLabel: 'Updated Count ',
		allowNegatife : false,
		blankText: '0',
		allowDecimals: false,
		anchor: '95%',
		maskRe: /([0-9]+)$/
	});


	m_pasal_btn_Save=new Ext.Button({
		text: BTN_SAVE,
		handler: m_pasal_save
	})
	/* Function for retrieve create Window Panel*/
	m_pasal_saveForm = new Ext.FormPanel({
		labelAlign: 'left',
		title: TITLE_FORM+' Pasal',
		bodyStyle:'padding:5px',
		autoHeight:true,
		layout:'form',
		width: 1100,
		collapsible: true,
		frame: true,
		renderTo: 'elwindow_m_pasal_save',
		items:[/* pasal_idField, */
				pasal_typeField,
				pasal_seqField,
				pasal_noField,
				pasal_titleField,
				pasal_contentField,
				pasal_activeField,
				/* pasal_created_dateField,
				pasal_created_byField,
				pasal_updated_dateField,
				pasal_updated_byField,
				pasal_updated_countField, */
				new  Ext.form.Label({html:'Keterangan : <font color=red>*</font>  '+INFO_REQUIRED })
		],
		buttons: [m_pasal_btn_Save
			,{
				text: BTN_CANCEL,
				handler: function(){
					m_pasal_reset_form();
				}
			}
		]
	});
	/* End  of Function*/


	/* Function for action list search */
	function m_pasal_list_search(){

		var pasal_id_search=null;
		var pasal_seq_search=null;
		var pasal_no_search=null;
		var pasal_title_search=null;
		var pasal_content_search=null;
		var pasal_active_search=null;
		var pasal_created_date_search_date="";
		var pasal_created_by_search=null;
		var pasal_updated_date_search_date="";
		var pasal_updated_by_search=null;
		var pasal_updated_count_search=null;

		/* if(pasal_idSearchField.getValue()!==null){pasal_id_search=pasal_idSearchField.getValue();} */
		if(pasal_seqSearchField.getValue()!==null){pasal_seq_search=pasal_seqSearchField.getValue();}
		if(pasal_noSearchField.getValue()!==null){pasal_no_search=pasal_noSearchField.getValue();}
		if(pasal_titleSearchField.getValue()!==null){pasal_title_search=pasal_titleSearchField.getValue();}
		if(pasal_contentSearchField.getValue()!==null){pasal_content_search=pasal_contentSearchField.getValue();}
		if(pasal_activeSearchField.getValue()!==null){pasal_active_search=pasal_activeSearchField.getValue();}
		/* if(pasal_created_dateSearchField.getValue()!==""){pasal_created_date_search_date=pasal_created_dateSearchField.getValue().format('Y-m-d');}
		if(pasal_created_bySearchField.getValue()!==null){pasal_created_by_search=pasal_created_bySearchField.getValue();}
		if(pasal_updated_dateSearchField.getValue()!==""){pasal_updated_date_search_date=pasal_updated_dateSearchField.getValue().format('Y-m-d');}
		if(pasal_updated_bySearchField.getValue()!==null){pasal_updated_by_search=pasal_updated_bySearchField.getValue();}
		if(pasal_updated_countSearchField.getValue()!==null){pasal_updated_count_search=pasal_updated_countSearchField.getValue();} */

		m_pasal_DataStore.baseParams = {
			task: 'SEARCH',
			pasal_id	:	pasal_id_search,
			pasal_seq	:	pasal_seq_search,
			pasal_no	:	pasal_no_search,
			pasal_title	:	pasal_title_search,
			pasal_content	:	pasal_content_search,
			pasal_active	:	pasal_active_search,
			pasal_created_date	:	pasal_created_date_search_date,
			pasal_created_by	:	pasal_created_by_search,
			pasal_updated_date	:	pasal_updated_date_search_date,
			pasal_updated_by	:	pasal_updated_by_search,
			pasal_updated_count	:	pasal_updated_count_search
		};

		m_pasal_DataStore.reload({params: {start: 0, limit: pageS}});
	}

	/* Function for reset search result */
	function m_pasal_reset_search(){
		m_pasal_DataStore.baseParams = { task: 'LIST' };
		m_pasal_DataStore.reload({params: {start: 0, limit: pageS}});
		//m_pasal_searchWindow.close();
	};
	/* End of Fuction */

	/* Field for search */
	/* Identify  pasal_id Search Field */
	pasal_idSearchField= new Ext.form.NumberField({
		id: 'pasal_idSearchField',
		fieldLabel: 'Id ',
		allowNegatife : false,
		blankText: '0',
		allowDecimals: false,
		anchor: '95%',
		maskRe: /([0-9]+)$/
	});
	/* Identify  pasal_seq Search Field */
	pasal_seqSearchField= new Ext.form.NumberField({
		id: 'pasal_seqSearchField',
		fieldLabel: 'Seq ',
		allowNegatife : false,
		blankText: '0',
		allowDecimals: false,
		anchor: '95%',
		maskRe: /([0-9]+)$/
	});
	/* Identify  pasal_no Search Field */
	pasal_noSearchField= new Ext.form.TextField({
		id: 'pasal_noSearchField',
		fieldLabel: 'No Pasal ',
		maxLength: 45,
		anchor: '95%'
	});
	/* Identify  pasal_title Search Field */
	pasal_titleSearchField= new Ext.form.TextField({
		id: 'pasal_titleSearchField',
		fieldLabel: 'Judul ',
		maxLength: 200,
		anchor: '95%'
	});
	/* Identify  pasal_content Search Field */
	pasal_contentSearchField= new Ext.form.TextField({
		id: 'pasal_contentSearchField',
		fieldLabel: 'Isi ',
		maxLength: 2000,
		anchor: '95%'
	});
	/* Identify  pasal_active Search Field */
	pasal_activeSearchField= new Ext.form.TextField({
		id: 'pasal_activeSearchField',
		fieldLabel: 'Aktif ',
		maxLength: 1,
		anchor: '95%'
	});
	/* Identify  pasal_created_date Search Field */
	pasal_created_dateSearchField= new Ext.form.DateField({
		id: 'pasal_created_dateSearchField',
		fieldLabel: 'Created Date ',
		format : 'Y-m-d'
	});
	/* Identify  pasal_created_by Search Field */
	pasal_created_bySearchField= new Ext.form.TextField({
		id: 'pasal_created_bySearchField',
		fieldLabel: 'Created By ',
		maxLength: 45,
		anchor: '95%'
	});
	/* Identify  pasal_updated_date Search Field */
	pasal_updated_dateSearchField= new Ext.form.DateField({
		id: 'pasal_updated_dateSearchField',
		fieldLabel: 'Updated Date ',
		format : 'Y-m-d'
	});
	/* Identify  pasal_updated_by Search Field */
	pasal_updated_bySearchField= new Ext.form.TextField({
		id: 'pasal_updated_bySearchField',
		fieldLabel: 'Updated By ',
		maxLength: 45,
		anchor: '95%'
	});
	/* Identify  pasal_updated_count Search Field */
	pasal_updated_countSearchField= new Ext.form.NumberField({
		id: 'pasal_updated_countSearchField',
		fieldLabel: 'Updated Count ',
		allowNegatife : false,
		blankText: '0',
		allowDecimals: false,
		anchor: '95%',
		maskRe: /([0-9]+)$/
	});

	/* Function for retrieve search Form Panel */
	m_pasal_searchForm = new Ext.FormPanel({
		labelAlign: 'left',
		layout:'form',
		bodyStyle:'padding:5px',
		autoHeight:true,
		frame: true,
		width: 500,
		items: [/* pasal_idSearchField, */
				pasal_seqSearchField,
				pasal_noSearchField,
				pasal_titleSearchField,
				pasal_contentSearchField,
				/* pasal_activeSearchField,
				pasal_created_dateSearchField,
				pasal_created_bySearchField,
				pasal_updated_dateSearchField,
				pasal_updated_bySearchField,
				pasal_updated_countSearchField */
		 ],
		buttons: [{
				text: BTN_SEARCH,
				handler: m_pasal_list_search
			},{
				text: BTN_CANCEL,
				handler: function(){
					m_pasal_searchWindow.hide();
				}
			}
		]
	});
    /* End of Function */

	/* Function for retrieve search Window Form, used for andvaced search */
	m_pasal_searchWindow = new Ext.Window({
		title: TITLE_FORM_SEARCH+' Pasal',
		closable:true,
		closeAction: 'hide',
		autoWidth: true,
		autoHeight: true,
		plain:true,
		layout: 'fit',
		x: 0,
		y: 0,
		modal: true,
		renderTo: 'elwindow_m_pasal_search',
		items: m_pasal_searchForm
	});
    /* End of Function */

  	/* Function for Displaying  Search Window Form */
	function display_form_search_window(){
		if(!m_pasal_searchWindow.isVisible()){
			m_pasal_searchWindow.show();
		} else {
			m_pasal_searchWindow.toFront();
		}
	}
  	/* End Function */

	/* Function for print List Grid */
	function m_pasal_print(){
		var searchquery = "";
		var pasal_id_print=null;
		var pasal_seq_print=null;
		var pasal_no_print=null;
		var pasal_title_print=null;
		var pasal_content_print=null;
		var pasal_active_print=null;
		var pasal_created_date_print_date="";
		var pasal_created_by_print=null;
		var pasal_updated_date_print_date="";
		var pasal_updated_by_print=null;
		var pasal_updated_count_print=null;

		if(m_pasal_DataStore.baseParams.query!==null){searchquery = m_pasal_DataStore.baseParams.query;}
		if(m_pasal_DataStore.baseParams.pasal_id!==null){pasal_id_print = m_pasal_DataStore.baseParams.pasal_id;}
		if(m_pasal_DataStore.baseParams.pasal_seq!==null){pasal_seq_print = m_pasal_DataStore.baseParams.pasal_seq;}
		if(m_pasal_DataStore.baseParams.pasal_no!==null){pasal_no_print = m_pasal_DataStore.baseParams.pasal_no;}
		if(m_pasal_DataStore.baseParams.pasal_title!==null){pasal_title_print = m_pasal_DataStore.baseParams.pasal_title;}
		if(m_pasal_DataStore.baseParams.pasal_content!==null){pasal_content_print = m_pasal_DataStore.baseParams.pasal_content;}
		if(m_pasal_DataStore.baseParams.pasal_active!==null){pasal_active_print = m_pasal_DataStore.baseParams.pasal_active;}
		/* if(m_pasal_DataStore.baseParams.pasal_created_date!==""){pasal_created_date_print_date = m_pasal_DataStore.baseParams.pasal_created_date;}
		if(m_pasal_DataStore.baseParams.pasal_created_by!==null){pasal_created_by_print = m_pasal_DataStore.baseParams.pasal_created_by;}
		if(m_pasal_DataStore.baseParams.pasal_updated_date!==""){pasal_updated_date_print_date = m_pasal_DataStore.baseParams.pasal_updated_date;}
		if(m_pasal_DataStore.baseParams.pasal_updated_by!==null){pasal_updated_by_print = m_pasal_DataStore.baseParams.pasal_updated_by;}
		if(m_pasal_DataStore.baseParams.pasal_updated_count!==null){pasal_updated_count_print = m_pasal_DataStore.baseParams.pasal_updated_count;} */

		Ext.Ajax.request({
		waitMsg: 'Please Wait...',
		url: 'index.php?c=c_m_pasal&m=get_action',
		params: {
			task: "PRINT",
		  	query: searchquery,
			pasal_id : pasal_id_print,
			pasal_seq : pasal_seq_print,
			pasal_no : pasal_no_print,
			pasal_title : pasal_title_print,
			pasal_content : pasal_content_print,
			pasal_active : pasal_active_print,
		  	pasal_created_date : pasal_created_date_print_date,
			pasal_created_by : pasal_created_by_print,
		  	pasal_updated_date : pasal_updated_date_print_date,
			pasal_updated_by : pasal_updated_by_print,
			pasal_updated_count : pasal_updated_count_print,
		  	currentlisting: m_pasal_DataStore.baseParams.task
		},
		success: function(response){
		  	var result=eval(response.responseText);
		  	switch(result){
		  	case 1:
				window.open('./print/m_pasal_printlist.html','m_pasallist','height=600,width=800,resizable=1,scrollbars=0, menubar=0');
				break;
		  	default:
				Ext.MessageBox.show({
					title: 'Warning',
					msg: FAILED_PRINT,
					buttons: Ext.MessageBox.OK,
					animEl: 'save',
					icon: Ext.MessageBox.WARNING
				});
				break;
		  	}
		},
		failure: function(response){
		  	var result=response.responseText;
			Ext.MessageBox.show({
			   title: 'Error',
			   msg: FAILED_CONNECTION,
			   buttons: Ext.MessageBox.OK,
			   animEl: 'database',
			   icon: Ext.MessageBox.ERROR
			});
		}
		});
	}
	/* Enf Function */

	/* Function for print Export to Excel Grid */
	function m_pasal_export_excel(){
		var searchquery = "";
		var pasal_id_2excel=null;
		var pasal_seq_2excel=null;
		var pasal_no_2excel=null;
		var pasal_title_2excel=null;
		var pasal_content_2excel=null;
		var pasal_active_2excel=null;
		var pasal_created_date_2excel_date="";
		var pasal_created_by_2excel=null;
		var pasal_updated_date_2excel_date="";
		var pasal_updated_by_2excel=null;
		var pasal_updated_count_2excel=null;

		if(m_pasal_DataStore.baseParams.query!==null){searchquery = m_pasal_DataStore.baseParams.query;}
		if(m_pasal_DataStore.baseParams.pasal_id!==null){pasal_id_2excel = m_pasal_DataStore.baseParams.pasal_id;}
		if(m_pasal_DataStore.baseParams.pasal_seq!==null){pasal_seq_2excel = m_pasal_DataStore.baseParams.pasal_seq;}
		if(m_pasal_DataStore.baseParams.pasal_no!==null){pasal_no_2excel = m_pasal_DataStore.baseParams.pasal_no;}
		if(m_pasal_DataStore.baseParams.pasal_title!==null){pasal_title_2excel = m_pasal_DataStore.baseParams.pasal_title;}
		if(m_pasal_DataStore.baseParams.pasal_content!==null){pasal_content_2excel = m_pasal_DataStore.baseParams.pasal_content;}
		if(m_pasal_DataStore.baseParams.pasal_active!==null){pasal_active_2excel = m_pasal_DataStore.baseParams.pasal_active;}
		/* if(m_pasal_DataStore.baseParams.pasal_created_date!==""){pasal_created_date_2excel_date = m_pasal_DataStore.baseParams.pasal_created_date;}
		if(m_pasal_DataStore.baseParams.pasal_created_by!==null){pasal_created_by_2excel = m_pasal_DataStore.baseParams.pasal_created_by;}
		if(m_pasal_DataStore.baseParams.pasal_updated_date!==""){pasal_updated_date_2excel_date = m_pasal_DataStore.baseParams.pasal_updated_date;}
		if(m_pasal_DataStore.baseParams.pasal_updated_by!==null){pasal_updated_by_2excel = m_pasal_DataStore.baseParams.pasal_updated_by;}
		if(m_pasal_DataStore.baseParams.pasal_updated_count!==null){pasal_updated_count_2excel = m_pasal_DataStore.baseParams.pasal_updated_count;} */

		Ext.Ajax.request({
		waitMsg: 'Please Wait...',
		url: 'index.php?c=c_m_pasal&m=get_action',
		params: {
			task: "EXCEL",
		  	query: searchquery,
			pasal_id : pasal_id_2excel,
			pasal_seq : pasal_seq_2excel,
			pasal_no : pasal_no_2excel,
			pasal_title : pasal_title_2excel,
			pasal_content : pasal_content_2excel,
			pasal_active : pasal_active_2excel,
		  	pasal_created_date : pasal_created_date_2excel_date,
			pasal_created_by : pasal_created_by_2excel,
		  	pasal_updated_date : pasal_updated_date_2excel_date,
			pasal_updated_by : pasal_updated_by_2excel,
			pasal_updated_count : pasal_updated_count_2excel,
		  	currentlisting: m_pasal_DataStore.baseParams.task
		},
		success: function(response){
		  	var result=eval(response.responseText);
		  	switch(result){
		  	case 1:
		  		window.open('./print/m_pasal_printlist.xls');
				break;
		  	default:
				Ext.MessageBox.show({
					title: 'Warning',
					msg: FAILED_EXCEL,
					buttons: Ext.MessageBox.OK,
					animEl: 'save',
					icon: Ext.MessageBox.WARNING
				});
				break;
		  	}
		},
		failure: function(response){
		  	var result=response.responseText;
			Ext.MessageBox.show({
			   title: 'Error',
			   msg: FAILED_CONNECTION,
			   buttons: Ext.MessageBox.OK,
			   animEl: 'database',
			   icon: Ext.MessageBox.ERROR
			});
		}
		});
	}
	/*End of Function */

	/* Show Hide control for permission */
	var pattr=new RegExp("R");
	var pattc=new RegExp("C");
	var pattu=new RegExp("U");
	var pattd=new RegExp("D");

	if(pattc.test(PERMISSION)==false){
		m_pasal_gbtn_add.setVisible(false);
	}else{
		m_pasal_gbtn_add.setVisible(true);
	}

	if(pattu.test(PERMISSION)==false){
		m_pasal_gbtn_update.setVisible(false);
		m_pasal_cbtn_update.setVisible(false);
	}else{
		m_pasal_gbtn_update.setVisible(true);
		m_pasal_cbtn_update.setVisible(true);
	}

	if(pattd.test(PERMISSION)==false){
		m_pasal_gbtn_delete.setVisible(false);
		m_pasal_cbtn_delete.setVisible(false);
	}else{
		m_pasal_gbtn_delete.setVisible(true);
		m_pasal_cbtn_delete.setVisible(true);
	}

	if(pattc.test(PERMISSION)==false && pattu.test(PERMISSION)==false){
		m_pasal_btn_Save.setVisible(false);
	}else{
		m_pasal_btn_Save.setVisible(true);
	}
});
	</script>
<body style: 'background: url(assets/images/desktop.jpg)'>
<div>
	<div class="col">
		<div id="elwindow_m_pasal_save"></div>
		<div>&nbsp;</div>
		<div id="fp_m_pasal"></div>
        <div id="elwindow_m_pasal_search"></div>
    </div>
</div>
</body>
</html>